
<template>
	<view class="content">
		<view class="cover-content">

			<!-- 手机号一键登录 -->
			<view class="wrap-quick-logon c-hide">
				<view class="huihui-full-logo"></view>
				<view class="phone-info">
					未注册手机号验证通过后将自动注册，<br/>
					您是否使用该账号登录？
					<view class="phone-number">
						+86 13201101010
					</view>
				</view>
				<view class="wrap-logon">
					<label>
						<checkbox value="cb" color="#FE7388" />登录注册即表示同意
					</label>
					<text class="link-text">用户协议、隐私条款</text>
					<button class="full-btn btn-wx-logon">手机号一键登录</button>
				</view>
				<view class="foot-buttons">
					<text class="link-text">更换手机号码</text>
				</view>
			</view>

			<!-- 短信验证码登录 -->
			<view class="wrap-msg-logon">
				<view class="wrap-info">
					<text class="content-title">短信验证码登录</text>
					<text>未注册手机号验证通过后将自动注册</text>
				</view>
				<view class="item">
					86+&nbsp;&nbsp;<input  v-model="phone" class="cover-input" @blur="inputData" focus type="number" placeholder="请输入手机号码"/>
				  <!-- 错误弹窗 -->
					<div class="error">{{s_telephone}}</div>
				</view>
				<view class="item">
					<input class="cover-input" type="number" placeholder="验证码"><button class="small-btn btn-send-captcha">发送验证码</button>
				</view>
				<view class="wrap-logon">
					<label>
						<checkbox value="cb" color="#FE7388" />登录注册即表示同意
					</label>
					<text class="link-text">用户协议、隐私条款</text>
					<button class="full-btn btn-msg-logon" @click="login">登录</button>
				</view>
			</view>

		</view>
	</view>
</template>
<script setup>
import { Consts, HTTP_API_URL } from '@/common/consts/Consts';
import { HttpMethod, httpUtil } from '@/common/netWork/httpUtil';
import { ref } from 'vue';
var phone=ref('11111')
var s_telephonel=ref('')
function inputData(e){
		var mobile=phone.value
		console.log('phone',mobile)
	  uni.setStorageSync('mobile',mobile)
		if(!(/^1[34578]\d{9}$/.test(mobile))){
				//手机的校验
				if(mobile===''){
					s_telephonel="手机号码格式错误";
					return false
					
				}else{ 
					//手机号正确则无错误信息
					s_telephonel="";
					return true
					
				}	
			}
	
}
async function login(){
	const mobile=uni.getStorageSync('mobile')
	console.log(mobile)
	uni.switchTab({
		url:'../home/home'
	})
	//有问题,暂未找到解决方法
	let data=await httpUtil.request(HTTP_API_URL.USER_LOGIN,HttpMethod.POST,{"mobile":"18710623877"})
	// console.log(data)
	uni.setStorageSync('token',JSON.parse(data.data).token)
}

</script>